import request from "@/utils/request";

/**
 * @description 获取所有包间列表
 */
export async function getAllRoomListAPI(p0: { page: number; pageSize: number; }) {
  return request.get('/rooms/getAllRooms', { params: p0 })
}

/**
 * @description 删除指定包间
 */
export async function deleteRoomAPI(id: string) {
  return request.delete(`/rooms/${id}`);
}


/**
 * @description 预约包间
 */
interface reverseData {
  roomId: string;
  startTime: string;
  endTime: string;
  purpose: string;
}
export async function reserveRoomAPI(data: reverseData) {
  return request.post('/rooms/reservations', data);
}

/**
 * @description 取消预约
 */
export async function cancelReservationAPI(id: string) {
  return request.put(`/rooms/reservations/{id}/cancel`);
}

/**
 * @description 获取指定日期所有的包间信息
 */

export async function getStatusByDayAPI(date: string) {
  return request.get('/rooms/status-by-day', { params: { date } });
}

/**
 * @description 获取指定日期区间的指定包间的信息
 */

export async function getStatusByDayAndRoomAPI(startDate: string, endDate: string, roomId: string) {
  return request.get(`/rooms/status/${roomId}`, { params: { startDate, endDate } });
}

/**
 * @description 新增包间
 */
interface RoomDataInterFace {
  id?: string;
  roomNumber: string;
  floorId: string;
  description: string;
  status?: string;
}
export async function addRoomAPI(data: RoomDataInterFace) {
  return request.post('/rooms/createRoom', data);
}

/**
 * @description 编辑包间
 */
export async function updateRoomAPI(data: RoomDataInterFace) {
  return request.put(`/rooms/${data.id}`, data);
}
